<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight.qml</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (QML) - Theme (Breeze Dark)"/>
</head><body style="background-color:#232629;color:#cfcfc2"><pre>
<span style="font-weight:bold;">import</span><span style="color:#27ae60;"> Qt 4.6</span>

<span style="color:#7a7c7d;">// some random qml snippets stolen from the qt docs</span>

<span style="color:#27ae60;">Rectangle</span> {
    <span style="color:#2980b9;">important</span>: <span style="font-weight:bold;">true</span>
    <span style="color:#2980b9;">propertyAsdf</span>:
    <span style="color:#2980b9;">id</span>: container
    <span style="color:#2980b9;">signalA</span>: bla
    <span style="font-weight:bold;">property</span> <span style="color:#2980b9;">string</span> label
    <span style="color:#0099ff;font-weight:bold;">signal</span> clicked
    <span style="color:#2980b9;">radius</span>: <span style="color:#f67400;">5</span>; border.<span style="color:#2980b9;">color</span>: <span style="color:#f44f4f;">&quot;black&quot;</span>
    <span style="color:#2980b9;">color</span>: mouse.<span style="color:#2980b9;">pressed</span> ? <span style="color:#f44f4f;">&quot;steelblue&quot;</span> : <span style="color:#f44f4f;">&quot;lightsteelblue&quot;</span>
    <span style="color:#2980b9;">gradient</span>: <span style="color:#27ae60;">Gradient</span> {
            <span style="color:#27ae60;">GradientStop</span> { <span style="color:#2980b9;">position</span>: mouse.<span style="color:#2980b9;">pressed</span> ? <span style="color:#f67400;">1.0</span> : <span style="color:#f67400;">0.0</span>; <span style="color:#2980b9;">color</span>: <span style="color:#f44f4f;">&quot;steelblue&quot;</span> }
            <span style="color:#27ae60;">GradientStop</span> { <span style="color:#2980b9;">position</span>: mouse.<span style="color:#2980b9;">pressed</span> ? <span style="color:#f67400;">0.0</span> : <span style="color:#f67400;">1.0</span>; <span style="color:#2980b9;">color</span>: <span style="color:#f44f4f;">&quot;lightsteelblue&quot;</span> }
    }
    <span style="color:#27ae60;">MouseRegion</span> { <span style="color:#2980b9;">id</span>: mouse; anchors.<span style="color:#2980b9;">fill</span>: parent; <span style="color:#2980b9;">onClicked</span>: container.<span style="color:#8e44ad;">clicked</span>() }
    <span style="color:#27ae60;">Text</span> { anchors.<span style="color:#2980b9;">fill</span>: parent; <span style="color:#2980b9;">text</span>: container.<span style="color:#2980b9;">label</span>; anchors.<span style="color:#2980b9;">centerIn</span>: parent }
}

<span style="color:#27ae60;">Rectangle</span> {
    <span style="color:#27ae60;">Script</span> {
        <span style="font-weight:bold;">function</span> <span style="color:#8e44ad;">calculateMyHeight</span>() {
            <span style="color:#fdbc4b;font-weight:bold;">return</span> <span style="color:#0099ff;">Math</span>.<span style="color:#8e44ad;font-style:italic;">max</span>(otherItem.<span style="color:#2980b9;">height</span>, thirdItem.<span style="color:#2980b9;">height</span>);
        }
    }

    anchors.<span style="color:#2980b9;">centerIn</span>: parent
    <span style="color:#2980b9;">width</span>: <span style="color:#0099ff;">Math</span>.<span style="color:#8e44ad;font-style:italic;">min</span>(otherItem.<span style="color:#2980b9;">width</span>, <span style="color:#f67400;">10</span>)
    <span style="color:#2980b9;">height</span>: <span style="color:#8e44ad;">calculateMyHeight</span>()
    <span style="color:#2980b9;">color</span>: { <span style="color:#fdbc4b;font-weight:bold;">if</span> (width &gt; <span style="color:#f67400;">10</span>) <span style="color:#f44f4f;">&quot;blue&quot;</span>; <span style="color:#fdbc4b;font-weight:bold;">else</span> <span style="color:#f44f4f;">&quot;red&quot;</span> }
}

<span style="color:#27ae60;">Rectangle</span> {
    <span style="font-weight:bold;">default property</span> <span style="color:#2980b9;">color</span> innerColor: <span style="color:#f44f4f;">&quot;black&quot;</span>
    <span style="font-weight:bold;">property</span> <span style="color:#2980b9;">color</span> innerColor: <span style="color:#f44f4f;">&quot;black&quot;</span>
    <span style="font-weight:bold;">property</span> <span style="color:#2980b9;">alias</span> text: textElement.<span style="color:#2980b9;">text</span>
    <span style="font-weight:bold;">property</span> <span style="color:#2980b9;">alias</span> aliasXYZ: testElement.<span style="color:#2980b9;">text</span>
    <span style="color:#0099ff;font-weight:bold;">signal</span> bar
    <span style="color:#0099ff;font-weight:bold;">signal</span> bar(<span style="color:#2980b9;">var</span> blah, <span style="color:#2980b9;">string</span> yxcv)
    <span style="color:#2980b9;">width</span>: <span style="color:#f67400;">240</span>; <span style="color:#2980b9;">height</span>: <span style="color:#f67400;">320</span>;
    <span style="color:#2980b9;">width</span>: <span style="color:#f67400;">100</span>; <span style="color:#2980b9;">height</span>: <span style="color:#f67400;">30</span>; <span style="color:#2980b9;">source</span>: <span style="color:#f44f4f;">&quot;images/toolbutton.sci&quot;</span>
    <span style="color:#27ae60;">ListView</span> {
        anchors.<span style="color:#2980b9;">fill</span>: parent
        <span style="color:#2980b9;">model</span>: contactModel
        <span style="color:#2980b9;">delegate</span>: <span style="color:#27ae60;">Component</span> {
            <span style="color:#27ae60;">Text</span> {
                <span style="color:#2980b9;">text</span>: modelData.<span style="color:#2980b9;">firstName</span> + <span style="color:#f44f4f;">&quot; &quot;</span> + modelData.<span style="color:#2980b9;">lastName</span>
            }
        }
    }
}

<span style="color:#27ae60;">Item</span> {
    <span style="font-weight:bold;">function</span> <span style="color:#8e44ad;">say</span>(text) {
        console.<span style="color:#8e44ad;">log</span>(<span style="color:#f44f4f;">&quot;You said &quot;</span> + text);
    }
}

<span style="color:#7a7c7d;">/*</span>
<span style="color:#7a7c7d;"> * multi line comment</span>
<span style="color:#7a7c7d;"> */</span>

<span style="color:#7a7c7d;">// single line comment</span>

<span style="font-weight:bold;">import</span><span style="color:#27ae60;"> QtQuick 2.0</span>

<span style="color:#27ae60;">Rectangle</span> {
    <span style="font-weight:bold;">property</span> <span style="color:#2980b9;">real</span> myNumProp: <span style="color:#f67400;">0.1e12</span>;
    <span style="font-weight:bold;">property</span> <span style="color:#2980b9;">alias</span> sub.<span style="color:#2980b9;">color</span>;
    <span style="color:#0099ff;font-weight:bold;">signal</span> mySignal(<span style="color:#2980b9;">int</span> arg1, <span style="color:#2980b9;">string</span> arg2)
    <span style="color:#2980b9;">color</span>: <span style="color:#f44f4f;">&quot;lightsteelblue&quot;</span>
    <span style="color:#2980b9;">width</span>: <span style="color:#f67400;">320</span>
    <span style="color:#2980b9;">height</span>: width/<span style="color:#f67400;">2</span>

    <span style="color:#27ae60;">Rectangle</span> {
        <span style="color:#2980b9;">id</span>: sub
        <span style="color:#2980b9;">width</span>: <span style="color:#f67400;">0x10</span>
        <span style="color:#2980b9;">height</span>: <span style="color:#f67400;">007</span>
        <span style="color:#2980b9;">objectName</span>: <span style="color:#f44f4f;">'single quote'</span>
        <span style="color:#2980b9;">objectName2</span>: a ? b : c;
    }
}
</pre></body></html>
